using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerIdlingState : PlayerGroundedState
{
    public PlayerIdlingState(PlayerMovementMachine playerMovementMachine) : base(playerMovementMachine)
    {
    }

#region IStateMethods
    public override void Enter()
    {
        base.Enter();
        StartAnimation(StateMachine.Player.AnimationData.IdleParameterHash);
        StateMachine.ReusableData.MovementSpeedModify = 0;
        StateMachine.ReusableData.CurrentJumpForce = airborneData.JumpData.StationaryJumpForce;
        ResetVelocity();
    }

    public override void Update()
    {
        base.Update();
        if (StateMachine.ReusableData.InputMovement == Vector2.zero)
            return;
        
        OnMove();
    }

    public override void PhysicUpdate()
    {
        base.PhysicUpdate();
        if (!IsMovingHorizontally())
        {
            return;
        }
        
        ResetVelocity();
    }

    public override void Exit()
    {
        base.Exit();
        StopAnimation(StateMachine.Player.AnimationData.IdleParameterHash);
    }
#endregion
}